package com.xmg.model.message;

import com.thoughtworks.xstream.annotations.XStreamAlias;
import com.xmg.model.Article;
import lombok.EqualsAndHashCode;
import lombok.Getter;
import lombok.Setter;
import lombok.ToString;

import java.util.List;
import java.util.Map;

/**
 * @author xmg
 * @Description 图文消息
 * @email 463364973@qq.com
 * <p>
 * Date:2019/4/5 18:02
 */
@ToString(callSuper = true)
@EqualsAndHashCode(callSuper = true)
@XStreamAlias("xml")
public class NewsMessage extends BaseMessage {

    /**
     * 图文消息个数；当用户发送文本、图片、视频、图文、地理位置这五种消息时，
     * 开发者只能回复1条图文消息；其余场景最多可回复8条图文消息
     */
    @Getter
    @Setter
    @XStreamAlias("ArticleCount")
    private String articleCount;

    /**
     * 图文消息信息，注意，如果图文数超过限制，则将只发限制内的条数
     */
    @Getter
    @Setter
    @XStreamAlias("Articles")
    private List<Article> articles;

    public NewsMessage(Map<String, String> requestMap, String articleCount, List<Article> articles) {
        super(requestMap);
        this.setMsgType("news");
        this.articleCount = articleCount;
        this.articles = articles;
    }
}
